<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_advinfo.*,com.lmpop.trade.ti_advpara.*,java.util.*" %>
<html>
	
	
	<%
	Hashtable ti_advinfo = new Hashtable();
	Ti_advpara ti_advpara = new Ti_advpara();
			String g_cust_id = "";	
	if( session.getAttribute("session_cust_id") != null ){
		g_cust_id = session.getAttribute("session_cust_id").toString();
		ti_advpara.setCust_id(g_cust_id);
	}
	String _adv_title="",_pos_id="",start_start_date="",start_end_date="",end_start_date="",end_end_date="";
	
	
	if(request.getParameter("n_adv_title")!=null && !request.getParameter("n_adv_title").equals("")){
	String adv_title = request.getParameter("n_adv_title");
	_adv_title=adv_title;
		ti_advinfo.put("adv_title",adv_title);
	}

	if(request.getParameter("pos_idx")!=null && !request.getParameter("pos_idx").equals("")){
	String pos_id = request.getParameter("pos_idx");
	_pos_id=pos_id;
	ti_advinfo.put("pos_id",pos_id);
	}

	if(request.getParameter("start_start_date")!=null && !request.getParameter("start_start_date").equals("")){
  start_start_date = request.getParameter("start_start_date");
	ti_advinfo.put("start_start_date",start_start_date);
	}
	if(request.getParameter("start_end_date")!=null && !request.getParameter("start_end_date").equals("")){
  start_end_date = request.getParameter("start_end_date");
	ti_advinfo.put("start_end_date",start_end_date);
	}
	
	
	if(request.getParameter("end_start_date")!=null && !request.getParameter("end_start_date").equals("")){
  end_start_date = request.getParameter("end_start_date");
	ti_advinfo.put("end_start_date",end_start_date);
	}
	if(request.getParameter("end_end_date")!=null && !request.getParameter("end_end_date").equals("")){
  end_end_date = request.getParameter("end_end_date");
	ti_advinfo.put("end_end_date",end_end_date);
	}
	

	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	String para =	"/program/admin/advInfo/index.jsp?n_adv_title="+_adv_title+"&pos_idx="+_pos_id+"&start_start_date="+start_start_date+"&start_end_date="+start_end_date+"&end_start_date="+end_start_date+"&end_end_date="+end_end_date+"&iStart="+Integer.parseInt(iStart)+"&limit="+limit;

	%>
  <head>
    
    <title>修改广告信息</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script language="javascript" type="text/javascript" src="js_advInfo.js"></script>
</head>

<body>

  <% 
  	String adv_id="";
  	if(request.getParameter("adv_id")!=null) adv_id = request.getParameter("adv_id");
  	Ti_advinfoInfo ti_advinfoInfo = new Ti_advinfoInfo();
  	List list = ti_advinfoInfo.getListByPk(adv_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String cust_id="",adv_title="",pos_id="",adv_src="",adv_text="",start_date="",end_date="",adv_url="",contact="",contact_info="",in_date="",user_id="",remark="";
  	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	if(map.get("adv_title")!=null) adv_title = map.get("adv_title").toString();
  	if(map.get("pos_id")!=null) pos_id = map.get("pos_id").toString();
  	if(map.get("adv_src")!=null) adv_src = map.get("adv_src").toString();
  	if(map.get("adv_text")!=null) adv_text = map.get("adv_text").toString();
  	if(map.get("start_date")!=null) start_date = map.get("start_date").toString();
  	if(map.get("end_date")!=null) end_date = map.get("end_date").toString();
  	if(map.get("adv_url")!=null) adv_url = map.get("adv_url").toString();
  	if(map.get("contact")!=null) contact = map.get("contact").toString();
  	if(map.get("contact_info")!=null) contact_info = map.get("contact_info").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("remark")!=null) remark = map.get("remark").toString();

			ti_advpara.setPos_id(pos_id);
	String selectdAds = new Ti_advparaInfo().getAdvparaSelected(ti_advpara);
  %>
	
	<h1>修改广告信息</h1>
	<form action="/doTradeReg.do" method="post" name="addForm">
	<table width="100%" cellpadding="1" cellspacing="1" border="0" class="listtab">
		
		<tr>
			<td align="right" width="10%">
				广告名称<font color="#ff0000">*</font>
			</td>
			<td  colspan="3"><input name="adv_title" id="adv_title" type="text" style="width:200px;" maxlength="100" value="<%=adv_title%>" /></td>
		</tr>
		
		<tr>
			<td align="right" valign="center" class="list_left_box">
				广&nbsp;告&nbsp;位<font color="#ff0000">*</font>
			</td>
			<td valign="center" colspan="3" >
				<select name="pos_id" id="pos_id">
					<option value="">请选择</option>
						<%=selectdAds%>
				</select>
			</td>
		</tr>
			
		<tr>
			<td align="right" width="10%">
				广告来源:
			</td>
			<td  colspan="3"><input name="adv_src" id="adv_src" style="width:200px;" type="text" value="<%=adv_src%>" /></td>
		</tr>
		
		<tr>
			<td align="right" valign="center" class="list_left_box">
				广告链接<font color="#ff0000">*</font>
			</td>
			<td valign="center" colspan="3">
				<input name="adv_url" id="adv_url" type="text" style="color:#999999;width:200px;" value="<%=adv_url%>" maxlength="300" size="40" class="input" />
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				链接图片:
			</td>
			<td colspan="3">
				<jsp:include page="/program/inc/uploadImgInc.jsp">
					<jsp:param name="attach_root_id" value="<%=adv_id%>" />
				</jsp:include>
			</td>
		</tr>
		
		<tr>
	      	<td  align="right" width="15%" >
			开始时间<font color="#ff0000">*</font>
			</td>
			<td width="15%" >
					<input name="start_date" id="start_date" value="<%=start_date%>" type="text" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'end_date\',{d:-1})}',readOnly:true})" style="width:200px;" class="Wdate" maxlength="10" />
				</td>

				<td align="right" width="15%">
							结束时间<font color="#ff0000">*</font>
				<td>
					<input name="end_date" id="end_date"  value="<%=end_date%>" type="text"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'start_date\',{d:1})}',readOnly:true})" style="width:200px;" class="Wdate"  value="" maxlength="10" />
				</td>
			</td>
		</tr>
				
				
		<tr>
			<td align="right" valign="center" class="list_left_box">
		 广告文本:
			</td>
			<td valign="top" colspan="3">
				<textarea name="adv_text" id="adv_text" cols="50" rows="6" onKeyUp="if(this.value.length > 500) this.value=this.value.substr(0,500)" ><%=adv_text%></textarea>
				<script type="text/javascript" src="/program/plugins/ckeditor/ckeditor.js"></script>
				<script type="text/javascript">
					//CKEDITOR.replace('adv_text');
	 
					 CKEDITOR.replace( 'adv_text',{
						filebrowserUploadUrl : '/program/inc/upload.jsp?type=file&attach_root_id=<%=adv_id%>',      
						filebrowserImageUploadUrl : '/program/inc/upload.jsp?type=img&attach_root_id=<%=adv_id%>',      
						filebrowserFlashUploadUrl : '/program/inc/upload.jsp?type=flash&attach_root_id=<%=adv_id%>'     
					});  
				</script>
			</td>
		</tr>		
		
	
		<tr>
			<td align="right" width="10%">
				联&nbsp;系&nbsp;人:
			</td>
			<td >
			<input name="contact" id="contact" type="text" style="width:200px;" maxlength="300" value="<%=contact%>"/>
		
			<td align="right" width="10%">
				联系方式:
			</td>
			<td  colspan="3"><input name="contact_info" id="contact_info" style="width:200px;" type="text" maxlength="300" value="<%=contact_info%>" onblur="isNum();" /></td>
		</tr>
		
		
	</table>
	
	<input name="cust_id" id="cust_id" type="hidden" value="<%=cust_id%>" />
	<input name="in_date" id="in_date" type="hidden"  value="<%=in_date%>"/>
	<input name="user_id" id="user_id" type="hidden" value="<%=user_id%>"/>
	<input name="adv_id" id="adv_id" type="hidden" value="<%=adv_id%>"/>
	<input name="remark" id="remark" type="hidden" value="" />
	
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="jumpurl" value="<%=para%>" />
				<input type="hidden" name="bpm_id" value="6891" />
	  			<input type="hidden" name="adv_id" value="<%=adv_id %>" />
				<input class="buttoncss" type="submit" name="tradeSub" value="提交" onclick="return updateSubForm();"/>&nbsp;&nbsp;
				<input class="buttoncss" type="button" name="tradeRut" value="返回" onclick="window.location.href='<%=para%>';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
